<?php
//Page-Level Plugin CSS - Tables
echo $this->Html->css('plugins/dataTables/dataTables.bootstrap');
//Table
echo $this->Html->script('plugins/dataTables/jquery.dataTables');
echo $this->Html->script('plugins/dataTables/dataTables.bootstrap');
?>

<div class="col-lg-12">
	<h2 class="page-header"><?php echo $title_for_layout?></h2>
</div>

<div id="mainTable">
	<table class="table table-striped table-bordered table-hover" id="dataTables-example">
		<thead>
			<tr>
				<th style="text-align:center">STT</th>
				<th>Tên menu</th>
				<th>Thứ tự</th>
				<th>Link</th>
				<th style="text-align: center;">Active</th>
				<th style="text-align:center"><img alt="sửa" src="<?php echo $this->webroot ?>img/edit.png" class="image"></th>
				<th style="text-align:center"><img alt="Xóa" src="<?php echo $this->webroot ?>img/delete.gif" class="image"></th>
			</tr>
		</thead>
		<tbody>
			<?php if ($this->Paginator->param('count') > 0) :?>
				<?php
				//$countno = ($this->Paginator->current($model = null) - 1) * $page_number_limit;
				foreach ($datas as $cat):
					$countno++;
				?>
				<tr <?php echo $changeBgTr; ?>>
					<td align="center"><?php echo $countno;?></td>
					<td>
						<?php
							for($j=0; $j < $cat["level"]; $j++) echo "-- ";
							echo $cat['mnu_name']
						?>
					</td>
					<td>
						<?php
							for($j=0; $j < $cat["level"]; $j++) echo "-- ";
							echo $cat['mnu_order']
						?>
					</td>
					<td><?php echo $cat['mnu_link'];?></td>
					<td align="center">
						<?php
							$checked = 0;
							if ($cat['mnu_active'] == 1) {
								$checked = 1;
							}
						?>
						<a class="news_update_active"  href="<?php echo $this->Html->url(array('controller' => 'menus', 'action' => 'update', $cat['id'], 'mnu_active')) ?>" title="Active or Inactive" rel="tooltip">
							<?php echo $this->Html->image("check_$checked.gif", array("alt" => "", 'class' => 'image_hot', 'value' => abs($cat['mnu_active'] - 1)));?>
						</a>
					</td>
					<td align="center"><a href="<?php echo $this->Html->url(array('controller' => 'menus', 'action' => 'edit', $cat['id'])) ?>"><?php echo $this->Html->image("edit.png", array("alt" => "sửa", 'class' => 'image'));?></a></td>
					<td align="center">
					<?php
						echo $this->Form->postLink(
							'Delete',
							array('controller' => 'menus', 'action' => 'delete', $cat['id']), null, __('Are you sure you want to delete ?', $cat['id'])
						);
					?>
					</td>

				</tr>
				<?php endforeach;?>
			<?php endif;?>
		</tbody>
	</table>



</div>

<?php //echo $this->element('sql_dump'); ?>